%ol.breadcrumb
  %li
    %i.fa.fa-dashboard.fa-prl5
    = link_to admin_root_path do
      管理首页
  %li.active
    %i.fa.fa-comments.fa-prl5
    评论管理
#admin-comment-index
  .table-responsive
    %table.table.table-bordered.table-hover.table-striped
      %thead
        %tr
          %th ID
          %th 内容
          %th 昵称
          %th 邮箱
          %th 评论于
          %th 创建时间
          %th 状态
          %th 操作
      %tbody
        - @comments.each do |c|
          %tr{id: "comment-#{c.id}"}
            %td
              = c.id
            %td
              = c.content
            %td
              = c.creator_name
            %td
              = c.creator_email
            %td
              = link_to "#{c.commentable_type == 'Post'? post_path(c.commentable) : page_path(c.commentable)}#comments" , target: '_blank' do
                = c.commentable.title
            %td
              = c.created_at.localtime.strftime("%x %H:%M")
            %td.status
              - if c.verified?
                已通过
              - else
                未通过
            %td.operation
              .verfy-button
                - if c.status == 2
                  .label.label-default.label-mr5
                    自己
                - elsif c.verified?
                  = link_to admin_comment_path(c, {status: 0}), method: :put, remote: true do
                    .label.label-default.label-mr5
                      撤回
                - else
                  = link_to admin_comment_path(c, {status: 1}), method: :put, remote: true do
                    .label.label-success.label-mr5
                      通过
              -#.label.label-warning.label-mr5
              -#  回复
              = link_to admin_comment_path(c), method: :delete, remote: true, data: {confirm: '确认删除此评论?'} do
                .label.label-danger.label-mr5
                  删除
= paginate @comments